package com.ferry.registry.domain.registry;

/**
 * Created by daiyong
 * 注册中心类型
 *
 * etcd 没有实现 因为不会
 */
public enum RegistryType {
	ZOOKEEPER(1, "zk"), ETCD(2, "etcd");

	private int code;
	private String protocolName;

	RegistryType(int code, String protocolName) {
		this.code = code;
		this.protocolName = protocolName;
	}

	public int getCode() {
		return code;
	}

	public String getProtocolName() {
		return protocolName;
	}

	public static RegistryType getRegistryTypeByProtocol(String protocol) {
		for (RegistryType value : values()) {
			if (value.getProtocolName().equals(protocol)) {
				return value;
			}
		}
		return null;
	}
}
